// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity.p_view;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.nnee.p_fk.cls_k;

public class cls_AttachmentImageView extends ImageView
    implements android.view.View.OnClickListener
{

    public cls_AttachmentImageView(Context context)
    {
        this(context, null);
    }

    public cls_AttachmentImageView(Context context, AttributeSet attributeset)
    {
        this(context, attributeset, 0);
    }

    public cls_AttachmentImageView(Context context, AttributeSet attributeset, int i)
    {
        super(context, attributeset, i);
        b = new Rect();
        d = false;
        setScaleType(android.widget.ImageView.ScaleType.CENTER_CROP);
        c = getResources().getDrawable(0x7f02000b);
        a = cls_k.a(getContext()).b(0x7f020009);
        a.setCallback(this);
        setPadding(a.getIntrinsicWidth() - a.getIntrinsicHeight(), 0, 0, 0);
        setOnClickListener(this);
    }

    public void a(int i)
    {
        if(i >= 0)
        {
            c = getResources().getDrawable(i);
            b.setEmpty();
        } else
        {
            c = null;
        }
    }

    public boolean a()
    {
        boolean flag;
        if(!d)
            flag = true;
        else
            flag = false;
        return flag;
    }

    protected void drawableStateChanged()
    {
        super.drawableStateChanged();
        if(a != null)
        {
            int ai[] = getDrawableState();
            a.setState(ai);
        }
    }

    public void onClick(View view)
    {
        if(view != null && view == this)
        {
            boolean flag;
            if(!d)
                flag = true;
            else
                flag = false;
            d = flag;
            if(!d)
                b.setEmpty();
            invalidate();
        }
    }

    protected void onDraw(Canvas canvas)
    {
        super.onDraw(canvas);
        Rect rect = b;
        if(rect.isEmpty())
        {
            int i = getWidth();
            int j = getHeight();
            rect.set(0, 0, i, j);
            a.setBounds(rect);
            if(c != null && !d)
                c.setBounds(0, 0, i, j);
        }
        a.draw(canvas);
        if(c != null && !d)
            c.draw(canvas);
    }

    protected void onMeasure(int i, int j)
    {
        setMeasuredDimension(a.getIntrinsicWidth(), a.getIntrinsicHeight());
    }

    protected void onSizeChanged(int i, int j, int l, int i1)
    {
        super.onSizeChanged(i, j, l, i1);
        b.setEmpty();
    }

    protected boolean verifyDrawable(Drawable drawable)
    {
        boolean flag;
        if(super.verifyDrawable(drawable) || drawable == a || drawable == c)
            flag = true;
        else
            flag = false;
        return flag;
    }

    private Drawable a;
    private Rect b;
    private Drawable c;
    private boolean d;
}
